import React from "react";
import { AboutMarkdownSection } from "../../components/AboutMarkdownSection";
import { HomeHeroCarousel } from "../../components/HomeHeroCarousel";
import { ProductCarouselSection } from "../../components/ProductCarouselSection";
import { SolutionsCarousel } from "../../components/SolutionsCarousel";
import { getAboutMarkdown, getFloors, getSolutions } from "../../lib/data";

export const revalidate = 300;

export default function HomePage({ params }: { params: { locale: string } }) {
  const locale = params.locale;

  const floors = getFloors(locale);
  const primaryFloor = floors[0];
  const solutionsData = getSolutions(locale);
  const aboutMarkdown = getAboutMarkdown();

  return (
    <main className="flex flex-col gap-0">
      <HomeHeroCarousel />

      {primaryFloor && (
        <ProductCarouselSection
          products={primaryFloor.products}
          title={
            primaryFloor.hero?.title ??
            primaryFloor.title ??
            "核心监测终端与智能设备"
          }
          description={
            primaryFloor.hero?.description ??
            primaryFloor.hero?.subtitle ??
            "多模态感知硬件覆盖城市结构安全监测的关键场景，支持长续航、低功耗与云端协同。"
          }
          eyebrow={primaryFloor.hero?.eyebrow ?? "Product Portfolio"}
        />
      )}

      {solutionsData?.items?.length ? (
        <SolutionsCarousel
          items={solutionsData.items}
          title={
            solutionsData.hero?.title ??
            solutionsData.title ??
            "行业安全监测解决方案矩阵"
          }
          description={
            solutionsData.hero?.description ??
            solutionsData.hero?.subtitle ??
            "覆盖房屋、边坡、交通、能源等多场景的安全监测方案，联动多源感知与云端智能决策。"
          }
          eyebrow={solutionsData.hero?.eyebrow ?? "Solutions Suite"}
        />
      ) : null}

      <AboutMarkdownSection content={aboutMarkdown} />
    </main>
  );
}

